<?php

class StateAfternoon implements State
{
    public function writeProgram(Work $work)
    {
        if ($work->getHour() < 15) {
            fwrite(STDOUT, '下午' . $work->getHour() . '点，有点困' . "\n");
        } else if ($work->getHour() < 18) {
            fwrite(STDOUT, '下午' . $work->getHour() . '点，进入工作状态' . "\n");
        } else {
            $work->setState(new StateEvening);
            $work->writeProgram();
        }
    }
}